package com.taobao.tbk.exception;

import com.taobao.tbk.error.CommonError;

public class CommonException extends Exception implements CommonError {

    private CommonError commonError;

    public CommonException(CommonError commonError) {
        super();
        this.commonError = commonError;
    }

    /**
     * 自定义异常信息
     * @param commonError  通用异常枚举
     * @param errMsg        异常信息
     */
    public CommonException(CommonError commonError, String errMsg) {
        super();
        this.commonError = commonError;
        this.setErrMsg(errMsg);
    }

    @Override
    public Integer getErrCode() {
        return this.commonError.getErrCode();
    }

    @Override
    public String getErrMsg() {
        return this.commonError.getErrMsg();
    }

    @Override
    public void setErrMsg(String errMsg) {
        this.commonError.setErrMsg(errMsg);
    }
}
